package leecode

func maxProfit(prices []int) int {
	result := 0
	//求每天的利润
	for i := 0; i+1 < len(prices); i++ {
		if prices[i+1]-prices[i] > 0 {
			result = result + prices[i+1] - prices[i]
		}
	}
	return result
}
